package com.qiji.video.util;

import com.sun.istack.internal.logging.Logger;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.ThreadPoolExecutor;

// An highlighted block
@Component("TimerWater")
public class TimerWater {
    private static Logger log = Logger.getLogger(TimerWater.class);
    public SimpleDateFormat now = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//    @Scheduled(cron = "0 10 0 1 * ?")
    @Scheduled(cron = "0/5 * * * * ? ")//每5秒执行一次
    public void GetWaterRealTimeData(){
        MyThread t=new MyThread();
        t.start();
    }
    class MyThread extends Thread{
        public MyThread(){
            super();
        }
        public void run(){
            log.info("TimeWater:执行更新实时数据, 开始" + now.format(new Date()));
            System.err.println("===========TimeWater: 执行更新实时数据, 开始");
            doNewInfo();
            log.info("TimeWater: 执行更新实时数据, 结束" + now.format(new Date()));
            System.err.println("===========TimeWater: 执行更新实时数据, 结束......");

        }
    }
    public void doNewInfo(){
    }
}
